<template>
	<view>
		<view class="bg-white padding-lr">
			<view class="padding-xs flex">
				<view class="flex-sub padding-xs">
					<view class="text-xl text-center align-center">
						<text class="text-black text-bold">{{msg.title}}</text>
					</view>
					<view class="solid-bottom padding text-center align-center">
						<text class="text-gray">发布者：</text><text class="text-gray">{{msg.pubCer}}</text>
						<text class="margin text-gray">发布时间：</text><text class="text-gray">{{msg.pubTime}}</text>
					</view>
					<rich-text :nodes="msg.text"></rich-text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msg: {}
			}
		},
		onLoad(options) {
			this.MsgData(options.id);
		},
		methods: {
			MsgData(id) {
				uni.showLoading({title:"加载中"});
				let params = {id: id}
				const that = this
				that.$request.getForm('/view/news/nview',params).then(res => {
					that.msg = res.data
					that.msg.pubTime = that.resolveDate(that.msg.pubTime);
					uni.hideLoading();
				})
			},
			resolveDate(date) {
				return date.substr(0,10);
			}
		}
	}
</script>

<style>
	page {
		background-color: #FFFF;
	}
	.img-bg {
		height: 3000px;
		width: 365px;
	}
</style>
